{include file="public/header" /}



<div class="page">

    <form id="add_form" method="post" action="{:url('Groupbuy/class_save')}">
        <input name="gclass_id" type="hidden" value="" />
        <table class="ds-default-table">
            <tbody>
            <tr class="noborder">
                <td colspan="2" class="required"><label for="input_gclass_name" class="validation">{$Think.lang.groupbuy_class_name}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input type="text" value="" name="input_gclass_name" id="input_gclass_name" class="txt"></td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2" class="required"><label for="input_parent_id">{$Think.lang.groupbuy_parent_class}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <select name="input_parent_id" id="input_parent_id">
                    <option value="0">{$Think.lang.groupbuy_root_class}</option>
                        {notempty name="groupbuyclass_list"}
                    {foreach name="groupbuyclass_list" item="val"}
                    <option {eq name="parent_id" value="$val.gclass_id" }selected='selected'{/eq} value="{$val.gclass_id}">{$val.gclass_name}</option>
                    {/foreach}
                    {/notempty}
                </select></td>
                <td class="vatop tips">{$Think.lang.groupbuy_parent_class_add_tip}</td>
            </tr>
            <tr>
                <td colspan="2" class="required"><label>{$Think.lang.ds_sort}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input type="text" value="0" name="input_sort" id="input_sort" class="txt"></td>
                <td class="vatop tips">{$Think.lang.sort_tip}</td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="2">
                    <input class="btn" type="submit" value="{$Think.lang.ds_submit}"/>
                </td>
            </tr>
            </tfoot>
        </table>
    </form>

</div>

<script type="text/javascript">
    $(document).ready(function(){
        $('#add_form').validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().prev().find('td:first'));
            },
            rules : {
                input_gclass_name : {
                    required : true
                },
                input_sort : {
                    number   : true,
                    range    : [0,255]
                }
            },
            messages : {
                input_gclass_name: {
                    required : '{$Think.lang.class_name_error}'
                },
                input_sort: {
                    number   : '{$Think.lang.sort_error}',
                    range    : '{$Think.lang.class_sort_explain}'
                }
            }
        });
    });
</script> 
